import 'package:auto_route/annotations.dart';
import 'package:auto_route/auto_route.dart';
import 'package:flutter/material.dart';
import 'package:sonora/config/sj_config.dart';
import 'package:sonora/shared/lib/constants/sj_colors.dart';
import 'package:sonora/utils/sj_device_utils.dart';
import 'package:sonora/utils/sj_screen_utils.dart';
import 'package:sonora/utils/sj_text_style.dart';
import 'package:sonora/views/appbar/sj_appbar.dart';
import 'package:sonora/views/navigation/routes/sj_app_router.dart';

@RoutePage()
class SjAboutPage extends StatelessWidget {
  const SjAboutPage({super.key});
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      extendBodyBehindAppBar: true, // 使内容延伸到导航
      appBar: SjAppbar(
        title: Text(
          'About',
          style: SjTextStyle.customFontBlack20,
        ),
        backgroundColor: Colors.transparent, // 设置导航栏背景为透明
        elevation: 0, // 去除导航栏阴影
        leading: IconButton(
          icon: Image.asset('assets/images/nav_back.png'), // 左侧按钮
          onPressed: () {
            // 处理返回逻辑
            Navigator.of(context).pop();
          },
        ),
      ),
      body: Container(
        padding: EdgeInsets.symmetric(horizontal: 32),
        width: double.infinity,
        decoration: BoxDecoration(
          image: DecorationImage(
            image: AssetImage('assets/images/post_bg.png'),
            fit: BoxFit.cover,
          ),
        ),
        child: SafeArea(
            child: Column(children: [
          SizedBox(
            height: 44,
          ),
          Image.asset(
            'assets/images/logo.png',
            width: 80,
            height: 80,
          ),
          SizedBox(
            height: 35,
          ),
          Container(
            padding: EdgeInsets.fromLTRB(20, 14, 20, 12),
            decoration: BoxDecoration(
              color: SjColors.themeAColor,
              borderRadius: BorderRadius.all(Radius.circular(12.0)),
            ),
            child: Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: [
                  Text(
                    'Version',
                    style: SjTextStyle.customFontBlack16,
                  ),
                  FutureBuilder<String>(
                      future: SjDeviceUtils.getAppVersion(),
                      builder: (context, snapshot) {
                        return Text(
                          '${snapshot.data}',
                          style: SjTextStyle.customFontBlack16,
                        );
                      }),
                ]),
          ),
          SizedBox(
            height: 24,
          ),
          InkWell(
            child: Container(
              padding: EdgeInsets.fromLTRB(20, 14, 20, 12),
              decoration: BoxDecoration(
                color: SjColors.themeAColor,
                borderRadius: BorderRadius.all(Radius.circular(12.0)),
              ),
              child: Row(
                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                  children: [
                    Text(
                      'Terms and Conditons',
                      style: SjTextStyle.customFontBlack16,
                    ),
                  ]),
            ),
            onTap: () {
              context.router.push(SjWebviewRoute(url: userAgreement, title: 'Terms and Conditons'));
            },
          ),
          SizedBox(
            height: 24,
          ),
          InkWell(
            child: Container(
              padding: EdgeInsets.fromLTRB(20, 14, 20, 12),
              decoration: BoxDecoration(
                color: SjColors.themeAColor,
                borderRadius: BorderRadius.all(Radius.circular(12.0)),
              ),
              child: Row(
                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                  children: [
                    Text(
                      'Privacy Policy',
                      style: SjTextStyle.customFontBlack16,
                    ),
                  ]),
            ),
            onTap: () {
              context.router.push(SjWebviewRoute(url: privacyAgreement, title: 'Privacy Policy'));
            },
          )
        ])),
      ),
    );
  }
}
